package com.sskj.test;
import android.arch.lifecycle.Observer;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.sskj.common.base.App;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ArrayList<String> strings = new ArrayList<>();
        strings.add(App.INSTANCE.getString(R.string.appmainActivity1));
        strings.add(App.INSTANCE.getString(R.string.testmainActivity1));
        strings.add(App.INSTANCE.getString(R.string.testmainActivity1));
        strings.add(App.INSTANCE.getString(R.string.testmainActivity1));
        strings.add(App.INSTANCE.getString(R.string.testmainActivity1));
        strings.add(App.INSTANCE.getString(R.string.testmainActivity1));

        LiveDataBus.get().with(1, String.class)
                .observe(this, new Observer<String>() {
                    @Override
                    public void onChanged(@Nullable String s) {
                        System.out.println(this + s);
                    }
                });
    }


    public void click(View view) {
        startActivity(new Intent(this, MainActivity.class));
    }

    public void send(View view) {
        LiveDataBus.get().with(1, String.class).postValue("1");
    }
}
